<!DOCTYPE html>
<html>
<head>
<title>req_assign</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css"
	href="/codebase/fonts/font_roboto/roboto.css" />
<link rel="stylesheet" type="text/css" href="/codebase/dhtmlx.css" />
<script type="text/javascript" src="/codebase/dhtmlx.js" />
<style>
div#simpleLog {
	height: 200px;
	font-family: Roboto, Arial, Helvetica;
	font-size: 14px;
	color: #404040;
	overflow: auto;
}

div.my_header div.text_block {
	height: 50px;
	line-height: 44px;
	font-size: 28px;
	color: #199BC6;
	margin-left: 5px;
	padding-left: 200px;
	background-image: url("/common/szsrcb-logo.png");
	background-repeat: no-repeat;
	background-position: center left;
}
</style>
<script>
	var myForm,my_form2, myGrid,formStructure;	
	var customCss = {
		video_bitrate : "validate_magenta",
		video_codec : "validate_orange"
	};
	function doOnLoad() {
		//req_query form setup
		if (myForm) {
			myForm.unload();
			myForm = null;
		}
		myForm = new dhtmlXForm("form_req_query");
		myForm.loadStruct("/common/testmanager/query_req.xml");

		myForm.attachEvent("onButtonClick",function(name){
			
			if(name=="req_search"){				
								
					/* var g_deffect_no=myForm.getItemValue("deffect_no");
					g_deffect_no=g_deffect_no.replace("#",">");
					var params = "?params=" + myForm.getItemValue("req_title")+"," + myForm.getItemValue("accept_date")+","+ myForm.getItemValue("req_bill_no")+","+ myForm.getItemValue("req_status")+"," + myForm.getItemValue("req_type")+","+myForm.getItemValue("req_offer_dept")
					+ "," + g_deffect_no; */
					myForm.send("/req/query_req_form_send","post",callback,false);					
										
			}
			
			if (name =="req_search_reset") {
				myForm.clear();
			}
		});		
		
		//grid setup
		if (myGrid) {			
			myGrid.clearAll(true);			
		}
		myGrid = new dhtmlXGridObject("grid_req_list");
		//myGrid.loadStruct("/common/testmanager/req_list.xml");
		myGrid.setImagePath("/codebase/imgs/");
		//需求编号  需求主题  需求状态  需求负责人  需求提出部门  要求完成日期  计划完成日  实际完成日
		myGrid.setHeader(",Req ID,需求编号,需求主题,需求状态,需求负责人,需求提出部门,要求完成日期,计划完成日,实际完成日,需求接收日,需求分配日");
		myGrid.setInitWidths("50,50,150,250,80,150,150,100,100,100,100,100");
		myGrid.setColAlign("center,center,left,left,left,left,left,center,center,center,center,center");
		myGrid.setColTypes("ra,ro,ed,ed,ro,ro,ro,ro,ro,ro,ro,ro");
		myGrid.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str");
		//myGrid.setColumnIds("first,second");
		myGrid.xml.top = "mytop";
		myGrid.xml.row = "./myrow";
		//myGrid.enableAutoWidth(true);
		//myGrid.enableAutoHeight(true);
		myGrid.init();		
	//	myGrid.load("/common/testmanager/req_list_test_data.xml", "xml");
		myGrid.attachEvent("onRowSelect",function(rowID,celInd){
		    //alert("The id of the selected row is "+rowID);		    
		    myGrid.cells(rowID,0).setValue("1");
		    
		});
		//open window button setup
		formStructure=null;
		formStructure=[
		               {type:"button",name:"assign_btn",value:"查看明细"}
			               ];
		
		if (my_form2) {
			my_form2.unload();
			my_form2 = null;
		}		
		my_form2=new dhtmlXForm("form_req_query_btn");
		//my_form2.loadStruct(formStructure);
		
		my_form2.attachEvent("onButtonClick", function(name) {		
			var get_row=myGrid.getCheckedRows(0);
			if(get_row==""){
				alert("请先选择一条需求");
			}
			else{
				createWindow();
			}				
		});
		
	}
	
	
	function callback(){
		if (arguments[1]=="false"){
			alert("查询信息失败！callback : "+arguments[1]);
			//window.location.pathname="index";
		}else{
		
			var r_array=arguments[1].split(",");
			//String r="req_size="+req_count+",plan_workload="+plan_workload_sum+",actual_workload="+actual_workload_sum+",req_ids="+req_ids;
			myForm.setItemLabel("display_label_req_count",r_array[0]);
			myForm.setItemLabel("display_label_workload_count",r_array[1]);
			myForm.setItemLabel("display_label_act_workload_count",r_array[2]);
			var ids=r_array[3];
			myGrid.clearAndLoad("/req/query_req_grid?" + ids,"json");	
			alert("查询信息成功");
			
		}
	}
	function createWindow() {
		//alert("open_createWindow");
		var p = 0;
		var id = "req_assign_window";
		//
		var w = 1000;
			var h = 500;
			var x = 10;
			var y = 10;
			
		//
		var dhxWins=new dhtmlXWindows();
		dhxWins.createWindow(id, x, y, w, h);
		dhxWins.window(id).setText("需求维护");
		
		dhxWins.window(id).denyPark();
		dhxWins.window(id).button("park").hide();
		dhxWins.window(id).setModal(true);
		
		var get_row=myGrid.getCheckedRows(0);
		var get_req_id=myGrid.cells(get_row,1).getValue();	
		dhxWins.window(id).attachURL("/req/req_modify_detail?req_id="+get_req_id);
			
	}
	
	
</script>
</head>
<body onload="doOnLoad();">
	<table>
		<tr>
			<td>
				<div id="form_req_query" style="padding-left: 50px;"></div>
			</td>
		</tr>
		
		<tr>
			<td>
				<div id="form_req_list" style="padding-left: 50px;"></div>
				<div id="grid_req_list"
					style="width: 1000px; height: 200px; background-color: white;">
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<div id="form_req_query_btn" style="padding-left: 100px;"></div>
			</td>
		</tr>
		<tr>
			<td>
				<div id="form_req_assign" style="padding-left: 100px;"></div>
			</td>
		</tr>
	
	</table>
</body>
</html>